<template>
  <div id="app">
    <home-header :seller="seller"></home-header>
    <home-tab></home-tab>
    <keep-alive exclude="Seller">
      <router-view :seller="seller"/>
    </keep-alive>
  </div>
</template>

<script>
  import {urlParse} from "./common/js/util";
  import HomeHeader from "./components/Header"
  import HomeTab from './components/Tab'
  const ERR_OK = 0;
    export default {
      name: 'App',
      data () {
        return {
          seller: {
            id: (() => {
              let queryParam = urlParse()
              return queryParam.id
            })()
          }
        }
      },
      created () {
        this.$http.get('/api/data.json?id='+this.seller.id).then((res) => {
          res = res.body
          if (res.errno === ERR_OK && res.seller) {
            this.seller = Object.assign({}, this.seller, res.seller)
            console.log(this.seller.id)
          }
        })
      },
      components: {
        HomeHeader,
        HomeTab
      }
    }
</script>

<style>
/*#app {*/
/*  font-family: 'Avenir', Helvetica, Arial, sans-serif;*/
/*  -webkit-font-smoothing: antialiased;*/
/*  -moz-osx-font-smoothing: grayscale;*/
/*  text-align: center;*/
/*  color: #2c3e50;*/
/*  margin-top: 60px;*/
/*}*/
</style>
